/*
 * TesterRental.java
 *
 * Created on March 29, 2007, 8:07 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package edu.byu.isys413.jjenkins.data;

import java.sql.Date;

/**
 * tester class for rentals
 * @author Josh
 */
public class TesterRental {
    
    
    /** Creates a new instance of TesterRental */
    public TesterRental() {
    }
    
    /**
     * main tester class
     * @param args params
     * @throws java.lang.Exception ex
     */
    public static void main(String[] args) throws Exception{
        try{
            Date date = new Date(System.currentTimeMillis());
            Date date2, date3, date4, date5;
            
            RentalBO rental = (RentalBO)RentalDAO.getInstance().create();
            rental.setDateOut(date);
            rental.setDateDue(date.valueOf("2007-04-01"));
            rental.setForRentID("product5");
            rental.setForRent((ForRentBO)ForRentDAO.getInstance().read("product5"));
            
            RentalReturnBO rentalReturn = RentalReturnDAO.getInstance().create();
            rentalReturn.setDateIn(date.valueOf("2007-04-03"));
            rentalReturn.setRental(rental);
            
            RentalDAO.getInstance().save(rental);
            RentalReturnDAO.getInstance().save(rentalReturn);
            
            FeeBO fee = (FeeBO)FeeDAO.getInstance().create();
            fee.setRental(rental);
            fee.calcPrice();
            
            System.out.println(fee.getPrice());
        }catch(DataException e){
            e.printStackTrace();
        }
    }
    
}
